﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using System.Web.Routing;

namespace Sparrow.VisualStudio.Debugger.RouteVisualizer
{
    [Serializable]
    public class BinaryRouteTransporter : RouteTransporter
    {
        public System.IO.Stream Stream
        {
            get;
            set;
        }

        public BinaryRouteTransporter(System.Web.Routing.RouteBase route)
        {
            BinaryFormatter serializer = new BinaryFormatter();
            serializer.Serialize(this.Stream, route);
        }

        public override System.Web.Routing.RouteBase Deserialize()
        {
            BinaryFormatter serializer = new BinaryFormatter();
            return serializer.Deserialize(this.Stream) as RouteBase;
        }
    }
}
